﻿<Window 
    x:Class="Converters"
    xmlns:local="clr-namespace:DataBinding"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Converters" Height="143" Width="300">
    <Window.Resources>
        <local:IsActiveToBrushConverter x:Key="isActiveToBrushConverter" />
        <BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
        
    </Window.Resources>
    <Grid DataContext="{x:Static local:Data.People}">
        <ListBox ItemsSource="{Binding}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <!--<StackPanel Visibility="{Binding Path=IsActive, Converter={StaticResource booleanToVisibilityConverter}}" Orientation="Horizontal">-->
                    <StackPanel TextBlock.Foreground="{Binding Path=IsActive, Converter={StaticResource isActiveToBrushConverter}}" Orientation="Horizontal">
                        <TextBlock Text="{Binding Path=FirstName}" FontSize="16" />
                        <TextBlock Text="{Binding Path=LastName}"  FontSize="16" Margin="3.5,0,7,0" />
                        <TextBlock Text="{Binding Path=Birthday, StringFormat=d}" FontSize="16" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Window>
